{template 'header'}
<ul class="nav nav-tabs">
    <li class=""><a href="{php echo $this->createWeburl('redBag');}">红包管理</a></li>
    <li class="active"><a href="{php echo $this->createWeburl('redBag', array('op' => 'addshow'));}">添加红包</a></li>
</ul>
<form action="" method="post" class="form-horizontal" id="myform" role="form" enctype="multipart/form-data">
    <div class="form-group">
        <label class="col-xs-12 col-sm-3 col-md-1 control-label">红包方式</label>
        <div class="col-sm-9 col-xs-12">
            <label class="radio-inline">
                <input type="radio" name="type" value="1" {if $redBag['type'] ==1 || $group['type'] == ''} checked {/if} />固定金额
            </label>
            <label class="radio-inline">
                <input type="radio" name="type" value="2" {if $redBag['type'] ==2} checked {/if}/>随机
            </label>
        </div>
    </div>
    <div class="form-group" id="fixed" {if $redBag['type'] ==2}  style="display: none"  {/if}>
        <label class="col-xs-12 col-sm-3 col-md-1 control-label">红包金额<span style="color: red">*</span>:</label>
        <div class="col-sm-7 col-lg-8 col-md-8 col-xs-12">
            <input class="form-control" name="money" placeholder="红包金额" value="{$redBag['money']}" type="text">
        </div>
    </div>
    <div class="form-group" id="rand" {if $redBag['type'] !=2}  style="display: none"  {/if}>
        <label class="col-xs-12 col-sm-3 col-md-1 control-label">随机范围:</label>
        <div class="col-sm-7 col-lg-8 col-md-8 col-xs-12" style="float: left">
            <input class="form-control" name="start" style="width:20%;float: left" placeholder="" value="{$redBag['start']}" type="text">
            <input class="form-control" name="end" style="width:20%;float: left" placeholder="" value="{$redBag['end']}" type="text">
        </div>
    </div>
    <div class="form-group">
        <label class="col-xs-12 col-sm-3 col-md-1 control-label">需要积分:</label>
        <div class="col-sm-7 col-lg-8 col-md-8 col-xs-12">
            <input class="form-control" name="integral" placeholder="需要积分" value="{$redBag['integral']}" type="text">
        </div>
    </div>
    <div class="form-group">
        <label class="col-xs-12 col-sm-3 col-md-1 control-label">需要连续签到多少天才能兑换:</label>
        <div class="col-sm-7 col-lg-8 col-md-8 col-xs-12">
            <input class="form-control" name="sign_days" placeholder="需要连续签到多少天才能兑换" value="{$redBag['sign_days']}" type="text">
        </div>
    </div>

    <div class="form-group">
        <label class="col-xs-12 col-sm-3 col-md-1 control-label">每天发放数量:</label>
        <div class="col-sm-7 col-lg-8 col-md-8 col-xs-12">
            <input class="form-control" name="number" placeholder="每天发放数量" value="{$redBag['number']}" type="text">
        </div>
    </div>
    <div class="form-group">
        <label class="col-xs-12 col-sm-3 col-md-1 control-label">每人总计可以领取次数:</label>
        <div class="col-sm-7 col-lg-8 col-md-8 col-xs-12">
            <input class="form-control" name="receive" placeholder="每人总计可以领取次数" value="{$redBag['receive']}" type="text">
        </div>
    </div>

    <div class="form-group">
        <label class="col-xs-12 col-sm-3 col-md-1 control-label">描述:</label>
        <div class="col-sm-7 col-lg-8 col-md-8 col-xs-12">
            <input class="form-control" name="describe" placeholder="描述" value="{$redBag['describe']}" type="text">
        </div>
    </div>

    <div class="form-group">
        <label class="col-xs-12 col-sm-3 col-md-1 control-label">顺序:</label>
        <div class="col-sm-7 col-lg-8 col-md-8 col-xs-12">
            <input class="form-control" name="sort" placeholder="顺序" value="{$redBag['sort']}" type="text">
        </div>
    </div>


    <div class="form-group">
        <label class="col-xs-12 col-sm-3 col-md-1 control-label"></label>
        <div class="" >
            <input type="hidden" name="op" value="{php echo $id ? 'edit' : 'add'}">
            <input type="hidden" name="id" value="{$id}">
            <input type="submit" name="submit" id="submit" value="{php echo $id ? '修改' : '新增'}" class="btn btn-primary">
        </div>
    </div>
</form>
{template 'footer'}
<script>
    $(function () {
        $("input[name='type']").click(function () {
            if ( $(this).val() ==1 ) {
                $('#fixed').show();
                $('#rand').hide();
            }  else {
                $('#fixed').hide();
                $('#rand').show();
            }
        });
    })
</script>